package com.wx.wechat;

import com.wx.wechat.config.WeChatConfig;
import com.wx.wechat.request.Unifiedorder;
import com.wx.wechat.service.impl.WeChatPayServiceImpl;
import com.wx.wechat.utils.WechatUtil;

import java.util.Map;

/**
 * @author wx
 * @Description: 测试微信请求接口
 * @date 2018/11/2 000222:22
 */
public class Main {
    public static void main(String[] agrs){
        WeChatPayServiceImpl webChatPayService = new WeChatPayServiceImpl();
        WeChatConfig weChatConfig = new WeChatConfig();
        weChatConfig.setAppId("xx");
        weChatConfig.setSecret("xx");
        weChatConfig.setMchId("xx");
        weChatConfig.setKey("xx");
        webChatPayService.setWeChatConfig(weChatConfig);
        Unifiedorder unifiedorder = new Unifiedorder();
        unifiedorder.setBody("xx");
        unifiedorder.setNotifyUrl("xx");
        unifiedorder.setOpenid("xx");
        unifiedorder.setOutTradeNo("xx");
        unifiedorder.setProductId("xx");
        unifiedorder.setSpbillCreateIp("192.168.1.1");
        unifiedorder.setTradeType("JSAPI");
        unifiedorder.setTotalFee(1);
        Map<String, String> unifiedOrder = webChatPayService.unifiedOrder(unifiedorder);
        System.out.println(WechatUtil.mapToXml(unifiedOrder));


    }
}
